package playbook

import (
	"time"

	"gddgame.cc/galaxy/core/models"

	. "gddgame.cc/galaxy/common/dsl/game/task"
)

type Player struct {
	OpenId   string
	Language string
	Ai       bool

	Open *models.UserOpen

	Online bool
	Exit   bool

	LanguageIndex int

	// 组队人数
	TeamNumber int
	TeamToken  string
	// 已完成任务
	FinishTasks map[int]struct{}
	// 可完成任务缓存
	AvailTask   []*GameTask
	TaskProcess map[int]*TaskProcess
	// 任务相关dataIndex
	taskDataIndex []int

	RealTaskProcess map[int]map[string]int32
	// 本次完成的任务
	Tasks map[int]time.Time

	// 单次战斗统计信息
	Playbook map[string]int32

	Result interface{}
}

func NewPlayer(openId string) *Player {
	p := &Player{
		Ai:     false,
		OpenId: openId,
	}
	return p
}

func (player *Player) BindOpen(open *models.UserOpen) {
	player.Open = open
	player.OpenId = open.Id
}

func (player *Player) SetRealProcess(process map[int]map[string]int32) {
	player.RealTaskProcess = process
}
